
// this
// console.log(this); // 浏览器中当前窗口， node 中 {}

const f = function () {
    // console.log(this); // window

    const a = function () {
        console.log(this); // window
    }
    return a;
}

// let a = f();
// a();
// f()();

function Person() {
    console.log(this); // 当前对象
    this.age = 0;

    setTimeout(() => {
        this.age++; // 这里的`this`正确地指向person对象
    }, 1000);
}

function Student() {
    this.name;
    this.age;

    let _that = this;

    this.setName = (name) => {
        _that.name = name;
    }

    this.getName = () => {
        return _that.name;
    }
}

// 创建对象
let stu = new Student();

// 内置函数
console.log(isFinite(1)); // true

console.log(isNaN(1)); // false
console.log(isNaN("a" + 1)); // true

// string --> number
let str = "1.93";

console.log(typeof (str - 0));
console.log(typeof parseFloat("a"));
console.log(typeof parseInt(str));


let url = "http://localhost/mvc?name=张三";

console.log(encodeURI(url));
console.log(decodeURI(url));

